package com.nobody.facepk.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.nobody.facepk.model.Comment;
import com.trg.dao.hibernate.GeneralDAO;
import com.trg.search.Search;

@Component
public class CommentDao {
	private GeneralDAO generalDao;
	
	public List<Comment> getComment(Long userId){
		Search search = new Search(Comment.class);
		search.addFilterEqual("userId", userId);
		return this.generalDao.search(search);
	}
	
	public List<Comment> getCommentByPic(Long pictureid){
		Search search = new Search(Comment.class);
		search.addFilterEqual("pictureId", pictureid);
		return this.generalDao.search(search);
	}
	
	@Autowired
	public void setGeneralDao(GeneralDAO generalDao) {
		this.generalDao = generalDao;
	}
}
